export  default {
	isMPSDK: function() {
		return new Promise((resolve, reject) => {
			
			console.log('isMPSDK');
			try {
				//通讯录里选择人员，然后发送给即时通讯进行聊天
				uni.sendNativeEvent('isMPSDK', {}, ret => {
					//this.nativeMsg = '宿主App回传的数据：' + ret;  
					resolve(ret);
				});
			} catch (e) {
				console.log(e);
				//TODO handle the exception
				reject('false');
			}
		});

	},

	selectPersonCall: function(e) {
		try {
			//通讯录里选择人员，然后发送给即时通讯进行聊天
			uni.sendNativeEvent('startMessage', e, ret => {
				//this.nativeMsg = '宿主App回传的数据：' + ret;  

			})
		} catch (e) {
			//TODO handle the exception
		}
	},
		
	// 手势密码跳转
	gestureCode: function(e) {		
		try {
			uni.sendNativeEvent('setsspawssword', {
				message: 'setsspawssword'
			}, ret => {
				//this.nativeMsg = '宿主App回传的数据：' + ret;  
			})
		} catch (e) {
			//TODO handle the exception
		}
	},	
	
	goBackMessagePage: function() {
		plus.runtime.quit();
		return;
		//点击菜单回到聊天窗口
		try {
			uni.sendNativeEvent('messagepage', {
				message: 'messagepage'
			}, ret => {
				// this.nativeMsg = '宿主App回传的数据：' + ret;  
			})
		} catch (e) {
			//TODO handle the exception
		}

	},
	loginout: function() {
		try {
			uni.sendNativeEvent('loginout', {
				message: 'loginout'
			}, ret => {
				//this.nativeMsg = '宿主App回传的数据：' + ret;  
			})
		} catch (e) {
			//TODO handle the exception
		}
	},
	updateHeader: function(imgPath) {
	  try {
	   uni.sendNativeEvent('updateHeader', imgPath, ret => {
	    //this.nativeMsg = '宿主App回传的数据：' + ret;  
	   })
	  } catch (e) {
	   //TODO handle the exception
	  }
	 },
	 getContacts: function(callback) {
	     try {
	      uni.sendNativeEvent('getContacts', 'getContacts', callback)
	     } catch (e) {
	      //TODO handle the exception
	     }
	    }
}
